import { storageLocal } from "@pureadmin/utils";

const LOCAL_NAME = "drawerStorage";

export interface DrawerState {
  rightShow: boolean;
}

export function defaultSetting(): DrawerState {
  return {
    rightShow: false,
  };
}

export function getLocalState(): DrawerState {
  const localSetting: DrawerState | undefined =
    storageLocal().getItem<DrawerState>(LOCAL_NAME);
  return { ...defaultSetting(), ...localSetting };
}

export function setLocalState(drawer: DrawerState): void {
  storageLocal().setItem(LOCAL_NAME, drawer);
}

export function removeLocalState() {
  storageLocal().removeItem(LOCAL_NAME);
}
